<html>
<head><title>PHP TEST</title></head>
<body>

<?php
session_start();
$dsn = 'mysql:dbname=orb;host=localhost';
$user = 'root';
$password = '';

try{
  $dbh = new PDO($dsn, $user, $password);

  $sql = 'select * from orb.Notes where UserName not in ("'.$_SESSION["UserName"].'")';
  $Users = $dbh->query($sql);
  
  $counter=0;
  print('<form action="mark.php" method="POST">');
  foreach ($Users as $row) {
	print('<h2>採点対象'.($counter+1).'</h2><br>');
    print('<img src="notes/'.$row['FileName'].'" width="750px" height="450px"><br>');
	print('<input type="hidden" name="'.($counter+1).'" value="'.$row['NoteId'].'">');
	print('右の欄に点数入力：<input type="text" name="name'.($counter+1).'"><br>');
	if($counter==2){ break; }
	$counter+=1;
  }
  print('<input type="submit" value="送る">');
  print('<input type="reset" value="取消">');
  print('</form>');
}catch (PDOException $e){
  print('Connection failed:'.$e->getMessage());
  die();
}


$pdo = null;
?>
</body>
</html>
